<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        function myPromise(url,method){
            return new Promise(function(resolve,reject){
                console.log(url,method);
                const str=`{"name":"zs","age":30}`;
                resolve(str);
            });
        }


        const p=myPromise('/news','get');  
        p.then((res)=>{
            console.log(res,typeof res);
            const json=JSON.parse(res);
            return json;
        }).then((res)=>{
            console.log(res,typeof res);
            return Object.assign(res,{gender:'女'});
        }).then(res=>{
            console.log(res);
            return p;
            // return new myPromise('/users','get');
        }).then((res)=>{
            console.log(res,typeof res);
        });     
        
    </script>
</body>
</html>